﻿using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;

namespace Adams.Admin.Presentation.Controllers
{
    [Authorize]
    [EnsureSsl]
    public class DonationsController : Controller
    {
        [AppendLayoutViewModel]
        public ActionResult Index()
        {
            var model = Business.Donations.Index.PageLoad();
            ViewBag.Message = Request["msg"];
            return View(model);
        }

        public JsonResult OneTimeGridLoad(DataTransfer.GridLoadInput gridinput)
        {
            var model = Business.Donations.Index.OneTimeGridLoad(gridinput);
            return Json(model);
        }

        public JsonResult RecurringGridLoad(DataTransfer.GridLoadInput gridinput)
        {
            var model = Business.Donations.Index.RecurringGridLoad(gridinput);
            return Json(model);
        }

        [AppendLayoutViewModel]
        public ActionResult Buckets()
        {
            var model = Business.Donations.Buckets.PageLoad();
            ViewBag.Message = Request["msg"];
            return View(model);
        }

        public JsonResult BucketsGridLoad(DataTransfer.GridLoadInput gridinput)
        {
            var model = Business.Donations.Buckets.GridLoad(gridinput);
            return Json(model);
        }

        [AppendLayoutViewModel]
        public ActionResult CreateBucket(int id)
        {
            var model = Business.Donations.CreateBucket.PageLoad(id);
            return View(model);
        }

        public JsonResult SaveBucket(Adams.Admin.DataTransfer.Donations.CreateBucket.FormInput input)
        {
            var model = Business.Donations.CreateBucket.Save(input);
            return Json(model);
        }
    }
}
